package com.lz.jaxb;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import java.io.File;

/**
 * Created by ZhouBing on 2017/8/18.
 */
public class XML2Java {
    /**
     * @param args
     * @throws JAXBException
     * @throws JAXBException
     */
    public static void main(String[] args) throws JAXBException {
        JAXBContext context = JAXBContext.newInstance(People.class);
        Unmarshaller unmarshaller = context.createUnmarshaller();

        File file = new File("D:/people.xml");

        //unmarshaller.unmarshal(xxx);
        People people = (People)unmarshaller.unmarshal(file);

        System.out.println(people.toString());
    }
}
